﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrator_WebSite/MasterPage.master" AutoEventWireup="true" CodeBehind="PlayerList.aspx.cs" Inherits="FootBallMatchProject.Piography.Admin.PlayerList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
            function SelectAll(id) {
                //get reference of GridView control
                var grid = document.getElementById("<%= gvView.ClientID %>");
                //variable to contain the cell of the grid
                var cell;

                if (grid.rows.length > 0) {
                    //loop starts from 1. rows[0] points to the header.
                    for (i = 1; i < grid.rows.length; i++) {
                        //get the reference of first column
                        cell = grid.rows[i].cells[0];

                        //loop according to the number of childNodes in the cell
                        for (j = 0; j < cell.childNodes.length; j++) {
                            //if childNode type is CheckBox                 
                            if (cell.childNodes[j].type == "checkbox") {
                                //assign the status of the Select All checkbox to the cell checkbox within the grid
                                cell.childNodes[j].checked = document.getElementById(id).checked;
                            }
                        }
                    }
                }
            }
</script>		
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
        <ContentTemplate>
            <table class="style2">
                <tr>
                    <td colspan="4" dir="rtl">
                        <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="اللاعبين" 
                            Width="100%"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 30%">
                        &nbsp;</td>
                    <td style="width: 40%">
                        &nbsp;</td>
                    <td style="width: 15%">
                        <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="اضافة" />
                    </td>
                    <td style="width: 15%">
                        <asp:Button ID="btnDelete" runat="server" onclick="btnDelete_Click" 
                            Text="حذف" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DropDownList ID="cmbSearch" runat="server" Width="100%">
                            <asp:ListItem Value="0">-اختيار -</asp:ListItem>
                            <asp:ListItem Value="1">اللاعب</asp:ListItem>
                            <asp:ListItem Value="2">النادي</asp:ListItem>
                            <asp:ListItem Value="3">المنتخب</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        <asp:TextBox ID="txtSearch" runat="server" Width="100%"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" 
                            Text="بحث" />
                    </td>
                    <td>
                        <asp:Button ID="btnClear" runat="server" onclick="btnClear_Click" Text="مسح" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <asp:GridView ID="gvView" runat="server" AutoGenerateColumns="False" 
                            Width="100%" AllowPaging="True" onpageindexchanging="gvView_PageIndexChanging" 
                            onrowcommand="gvView_RowCommand" PageSize="20">
                            <Columns>
                                <asp:TemplateField>
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </EditItemTemplate>
                                    <HeaderTemplate>
                                        <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                                            <ContentTemplate>
                                                <asp:CheckBox ID="cbHeader" runat="server" AutoPostBack="True" 
                                                    oncheckedchanged="cbHeader_CheckedChanged" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                            <ContentTemplate>
                                                <asp:CheckBox ID="cbDetail" runat="server" AutoPostBack="True" 
                                                    oncheckedchanged="cbDetail_CheckedChanged" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </ItemTemplate>
                                    <FooterStyle Width="3%" />
                                    <HeaderStyle Width="3%" />
                                    <ItemStyle Width="3%" />
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        <asp:Label ID="Label2" runat="server" Text="اللاعب"></asp:Label>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" 
                                            CommandArgument='<%# Eval("ID") %>' Text='<%# Bind("Name") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        <asp:Label ID="Label3" runat="server" Text="تاريخ الميلاد"></asp:Label>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" 
                                            
                                            Text='<%# System.DateTime.Parse(Eval("BirthDate").ToString()).ToString("dd/MM/yyyy") %>' 
                                            CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        <asp:Label ID="Label4" runat="server" Text="النادي"></asp:Label>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton3" runat="server" 
                                            Text='<%# Bind("ClubName") %>' CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        <asp:Label ID="Label5" runat="server" Text="المنتخب"></asp:Label>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton4" runat="server" 
                                            Text='<%# Bind("NationalTeamName") %>' CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <PagerSettings Mode="NextPreviousFirstLast" />
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td colspan="2">
                        &nbsp;</td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    
</asp:Content>
